﻿using System;

using E.BLL;
using E.Model;
using E.Web.UI.Page;

using X.Common;

namespace E.Web.training.info
{
    public partial class UpdatePwd : BasePage
    {
        protected override void ShowPage()
        {
            if (ispost)
            {
                string originalpwd = XRequest.GetString("OriginalPwdTxt");
                string newpwd = XRequest.GetString("NewPwdTxt");
                string confirmpwd = XRequest.GetString("ConfirmNewPwdTxt");

                if (originalpwd.Equals("") || newpwd.Equals("") || confirmpwd.Equals("") || newpwd != confirmpwd || newpwd.Length < 6)
                {
                    ExecuteJS("alert('信息填写错误');");
                }
                else
                {
                    int rst = (new UserBLL()).UpdatePasswordWithOriginalPwd(userid, Utils.MD5(originalpwd), Utils.MD5(newpwd));
                    if (rst > 0)
                    {
                        ExecuteJS("alert('更新成功');");
                    }
                    else
                    {
                        ExecuteJS("alert('信息填写错误');");
                    }
                }

            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
